<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Elenco assenze da giustificare</title>
<meta name="description" content="" />
<meta name="keywords" content="scuola, iglesias, didattica, insegnamento, docenti, scuola media" />
<link rel="stylesheet" href="andreas08.css" type="text/css" media="screen,projection" />
<script type="text/javascript" src="../../../js/page.js"></script>
<script type="text/javascript" src="../../../js/prototype.js"></script>
<script type="text/javascript">
var data_giustificata;
function giustifica(id_alunno, id_registro) {
	var url = "giustifica.php";
	var req = new Ajax.Request(url,
	  {
	    	method:'post',
	    	parameters: {alunno: id_alunno, registro: id_registro},
	    	onSuccess: function(transport){
	      		var response = transport.responseText || "no response text";
	      		if(response == "ok"){
	      			document.getElementById("giust_"+data_giustificata).style.display = "none";
	     		}
	     		else{
	     			_alert("Impossibile completare l'operazione richiesta. Riprovare tra qualche secondo o segnalare l'errore al webmaster");
		     		return;
	     		}
	    	},
	    	onFailure: function(){ _alert("Si e' verificato un errore...") }
	  });
	data_giustificata = id_registro;
}
</script>
</head>
<body style="background-color: white">
<div style="text-align: center; font-weight: bold; padding-bottom: 25px">Elenco assenze da giustificare<br />Alunno <?php print $_alunno['cognome']." ".$_alunno['nome'] ?></div>
<div style="width: 90%; text-align: left; margin: auto;">
<?php
setlocale(LC_TIME, "it_IT");
$idx = 0;
while($ass = $res_assenze_ingiustificate->fetch_assoc()){
	$giorno_str = utf8_encode(strftime("%A", strtotime($ass['data'])));
	$background = "";
	if($idx%2)
		$background = "background-color: #e8eaec";
?>
<p id="giust_<?php print $ass['id_registro'] ?>" style="height: 20px; padding-bottom: 0px; vertical-align: middle; border-bottom: 1px solid; padding-left: 20px; <?php print $background ?>"><?php print substr($giorno_str, 0, 3)." ". format_date($ass['data'], SQL_DATE_STYLE, IT_DATE_STYLE, "/") ?>
	<span style="float: right; margin-right: 45px;">
		<a href="#" onclick="giustifica(<?php print $_REQUEST['id'] ?>, <?php print $ass['id_registro'] ?>)" style="color:black; font-weight: normal; text-decoration: underline;">Giustifica</a>
	</span>
</p>
<?php
	$idx++;
}
?>
</div>
<div style="float: right; margin-top: 130px; margin-right: 45px; ">
	<a href="#" onclick="parent.document.location.reload(); ">Chiudi</a>
</div>
</body>
</html>